home *** CD-ROM | disk | FTP | other *** search
- /************************************************/
- /* Sample DLL's */
- /* Copyright © Vincent Parsons 1989. */
- /************************************************/
- /* DLL code for MPW C 3.0 or THINK C 4.0 */
- /* with Excel for the Macintosh 2.2 */
- /* and Microsoft C 5.1 */
- /* with Excel for Windows 2.1 */
- /************************************************/
- /* Flash is an example of direct manipulation */
- /* of the screen from a DLL. The DLL inverts */
- /* the window rectangle twice the input */
- /* parameter times. */
- /************************************************/
- /* =REGISTER("SampDLLs","Flash","AI") */
- /* for both the Mac and the PC. */
- /************************************************/
-
- #ifdef applec
-
- #include <Types.h>
- #include <Memory.h>
- #include <OSUtils.h>
- #include <QuickDraw.h>
-
- #elif MSDOS
- #include <windows.h>
-
- #endif
-
- #ifdef THINK_C
- pascal unsigned short main(short flashCount); /* prototype */
-
- pascal unsigned short main(flashCount)
- short flashCount;
-
- #elif applec
- pascal unsigned short Flash(short flashCount)
-
- #elif MSDOS
- unsigned short far pascal Flash(short flashCount)
- #endif
- {
- short again;
- #if THINK_C | applec
- GrafPtr port;
-
- GetPort(&port);
- for (again = 1; again <= flashCount; again++) {
- InvertRect(&port->portRect);
- InvertRect(&port->portRect);
- }
- #elif MSDOS
- HWND myWindowHandle;
- HDC myDisplayContext;
- RECT myRect;
-
- myWindowHandle = GetActiveWindow();
- myDisplayContext = GetWindowDC(myWindowHandle);
- GetWindowRect(myWindowHandle, (LPRECT)&myRect);
- for (again = 1; again <= flashCount; again++) {
- InvertRect(myDisplayContext, (LPRECT)&myRect);
- InvertRect(myDisplayContext, (LPRECT)&myRect);
- }
- ReleaseDC(myWindowHandle,myDisplayContext);
- #endif
- return(again);
- }
-
- /************************************************/
-